//用户提现
$(document).ready(function(){
if(myinfo['userid'] && myinfo['random']){
       saveinfo();
    $("#save").click(function(){
        if($('#checkbox').is(':checked')) {
            var check=1; //积分抵扣
        }else{
            var check=2;//一般体现
        }
        var money = $("#money").val();
        var type ='2';
        var paypal ='1';
        var random= myinfo['random'];
        if (money == '' || money <= 0 ){
            art.dialog({
                lock: true,
                fixed: true,
                icon: 'face-sad',
                title: '错误提示',
                content: '请输入正确金额',
                ok: true
            });
            return false;
        }
        var save_url=myconfig['api']+'person_cash';
        $.post(save_url, {userid:myinfo['userid'],check:check,money:money,type:type,paypal:paypal,random:random},function(datas,status){
            if (datas.status==1){
                art.dialog({
                    lock: true,
                    fixed: true,
                    icon: 'face-smile',
                    title: '操作成功',
                    content: datas.msg,
                    ok: true
                });
                $("#money").val("");
                saveinfo();
            }else{
                art.dialog({
                    lock: true,
                    fixed: true,
                    icon: 'face-sad',
                    title: '错误提示',
                    content: datas.msg,
                    ok: true
                });
                $("#money").val("");
                return false;
            }
        })
    })
}else{
    window.location.href='./login.html';
}

    //积分 次数 费率
    function saveinfo(){
        var info_url=myconfig['api']+'save_info';
        $.post(info_url, {uid:myinfo['userid']},function(data,status){
            $("#uname").html('提现姓名&nbsp;<b>'+data.name+'</b>');//
            $("#count").html(data.count);//
            $("#jifen").html(data.point);//
            $("#fee").html(data.fee+'%');//
            $("#moneys").html('￥'+data.money);
        })
    }
    //费率提示
    $("#money").keyup(function(){
        var nums=$("#money").val();
        var purl=myconfig['api']+'total_money';
        $.post(purl,{money:nums,uid:myinfo['userid']},function(data){
            $("#deposite_sj").html('￥'+data.tots);//实际到账
            $("#deposite_sxf").html('￥'+data.tot);//实际提现费
        },'json');
    });
     
})